package dataflow.core;

public class DataEvent implements IEvent {

	private final ConnectionAnchor in;
	private final ConnectionAnchor out;
	private final Object data;
	
	public DataEvent(ConnectionAnchor out, Object data, ConnectionAnchor in) {
		this.in = in;
		this.out = out;
		this.data = data;
	}

	
	@Override
	public void execute() {
		if(in.pe.receiveData(data, in.portName)){
			out.pe.receiveResponse(EventMsg.delivered_ok, out.portName);
		}
	}

}
